package com.example.demo;

import org.ly.uap.client.authentication.AttributePrincipal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class IndexView {

    @Autowired
    private HttpServletRequest request;

    @Autowired
    private HttpServletResponse response;

    @RequestMapping("/")
    public String view(){

        AttributePrincipal principal = (AttributePrincipal)request.getUserPrincipal();
        String username = principal.getName();
        System.out.println(username);
        System.out.println("123");
        return "index.html";
    }
}
